package cn.it.ygh.service.impl;

import java.util.ArrayList;
import java.util.List;

import javax.annotation.Resource;

import org.springframework.dao.DataIntegrityViolationException;
import org.springframework.stereotype.Service;

import com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException;

import cn.it.ygh.mapper.UserManageMapper;
import cn.it.ygh.pojo.User;
import cn.it.ygh.service.UserManageService;

@Service("userManageService")
public class UserManageServiceImpl implements UserManageService {
	@Resource
	private UserManageMapper userManageMapper;
	@Override
	public List<User> getAllUser() {
		// TODO Auto-generated method stub
		List<User> userList = new ArrayList<User>();
		userList = userManageMapper.getAllUser();
		return userList;
	}

	@Override
	public void deleteUser(int userId) throws DataIntegrityViolationException {
		// TODO Auto-generated method stub
		userManageMapper.deleteUser(userId);
	}

	@Override
	public void modifyUser(User user) {
		// TODO Auto-generated method stub
		userManageMapper.modifyUser(user);
	}

	@Override
	public void addUser(User user) {
		// TODO Auto-generated method stub
		userManageMapper.addUser(user);
	}

	@Override
	public void batchdeleteUser(int[] ids) {
		// TODO Auto-generated method stub
		userManageMapper.batchdeleteUser(ids);
	}

	@Override
	public User getUserById(int userId) {
		// TODO Auto-generated method stub
		User user =userManageMapper.getUserById(userId);
		return user;
	}

	@Override
	public List<User> findUser(String key) {
		// TODO Auto-generated method stub
		return userManageMapper.findUser(key);
	}

	@Override
	public List<User> getPageData(int pageStart, int pageSize,String key) {
		// TODO Auto-generated method stub
		return userManageMapper.getPageData(pageStart, pageSize,key);
	}

	@Override
	public int getTotalRecord(String key) {
		// TODO Auto-generated method stub
		return userManageMapper.getTotalRecord(key);
	}

}
